package com.ruoyi.kenuo.controller;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.kenuo.service.IEquService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Api(tags="数据统计相关接口")
@RestController
@RequestMapping("/kenuo/statics")
public class StatisticsController {


    @Resource
    private IEquService equService;

    @ApiOperation(value="获取首页基本统计数据", httpMethod = "GET")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query", name = "mode", value = "设备型号", required = true, dataType = "String")
    })
    @GetMapping("/getBasicData")
    public AjaxResult getBasicData(String mode){
        Map<String,Object> mp = equService.getBasicData(mode);
        return AjaxResult.success(mp);
    }


    @ApiOperation(value="获取首页图表数据", httpMethod = "POST")
    @PostMapping("/getIndexTb")
    public AjaxResult getIndexTb(){
        Map<String,Object> mp = equService.getIndexTb();
        return AjaxResult.success(mp);
    }
    @ApiOperation(value="获取首页地图信息", httpMethod = "POST")
    @PostMapping("/getIndexDt")
    public AjaxResult getIndexDt(){
        List<Map<String,Object>> mp = equService.getIndexDt();
        return AjaxResult.success(mp);
    }

}
